Test Series - java script

Test Number 40/92

Q: What does a Node object represent?
A. Single node
B. Set of nodes
C. Sequence of nodes
D. Node array
Solution: The Node object represents a single node in the document tree. A node can be an element node, an attribute node, a text node, or any other of the node types explained in the Node Types chapter.
Q: What does the nodeName of the nodeType Document return?
A. doctype name
B. target
C. #comment
D. #document
Solution: The nodeName of the nodeType Document returns #document. If the node is an element node, the nodeName property will return the tag name. If the node is an attribute node, the nodeName property will return the name of the attribute.
Q: What is the purpose of the method item()?
A. Returns node after the specified index
B. Returns node before the specified index
C. Returns node at specified index
D. Returns the node following the specified node
Solution: The method item() returns the node at the specified index in a node list. The nodes are sorted as they appear in the source code, and the index starts at 0.A Node object’s collection of child nodes is an example of a NodeList object.
Q: How can the nodes in the node list be accessed?
A. Key
B. Index number
C. Looping
D. Value
Solution: The nodes in the node list can be accessed through their index number. The nodes are sorted as they appear in the source code, and the index starts at 0.
Q: Which of the following is the child(s) of the node type EntityReference?
A. Element
B. Text
C. Both Element and Text
D. Entity
Solution: The createEntityReference() method creates the specified EntityReference Object. The children of the node type EntityReference are Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference.
Q: Which node type represents the root-node of the DOM tree?
A. Document
B. DocumentFragment
C. DocumentType
D. Entity
Solution: Everything inside an html document is classified in the form of different nodes. The node type Document represents the root-node of the DOM tree, the entire document.
Q: What is the purpose of the DocumentFragment node type?
A. To hold a portion of a document
B. To split the document into fragments
C. To hold the entire document
D. To hold the fragments
Solution: The DocumentFragment node type represents a “lightweight” Document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document.
Q: How many nodetype – named constants are available?
A. 13
B. 11
C. 10
D. 12
Solution: DOM nodes can be of various types, such as element nodes and text nodes, and each node has a nodeType property giving its type. There are totally 12 nodetype – named constants available.
Q: Which of the following Node types have a node value equal to null?
A. Document
B. DocumentFragment
C. DocumentType
D. All of the mentioned
Solution: All the three node types namely, Document, DocumentFragment, DocumentType have a node value equal to null. If the node is an element node, the nodeType property will return 1. If the node is an attribute node, the nodeType property will return 2.
Q: How many node object properties are there?
A. 12
B. 14
C. 16
D. 17
Solution: Node interface is the primary datatype for the entire Document Object Model. The node is used to represent a single XML element in the entire document tree. There are totally 16 node object properties.

You Have Score    /10